#ifndef MESSAGEEVENT_H
#define MESSAGEEVENT_H

#include "abstractevent.h"


namespace Converse {
class AbstractMessage;
class AbstractConversation;
}

class MessageEvent : public AbstractEvent
{
    Q_OBJECT
public:
    enum MessageEventType {
        TextMessageEvent = 0,
        PhotoMessageEvent = 1,
        VoiceMessageEvent = 2
    };

public:
    MessageEvent(qint64 id,
                 qint64 sendingId,
                 qint64 conversationId,
                 qint64 createdTime,
                 qint64 senderId,
                 qint64 receiverId,
                 QObject *parent = 0);

private:
    qint64 m_id;
    qint64 m_sendingId;
    qint64 m_conversationId;
    qint64 m_createdTime;
    qint64 m_senderId;
    qint64 m_receiverId;

public:
    virtual Converse::AbstractMessage *createMessage(const Converse::AbstractConversation &conversation,
                                                     QObject *parent) const = 0;

public:
    virtual void process();
    virtual MessageEventType messageEventType() const = 0;
    virtual AbstractEvent::EventType eventType() const;

public:
    inline qint64 id() const {
        return m_id;
    }

    inline qint64 sendingId() const {
        return m_sendingId;
    }

    inline qint64 conversationId() const {
        return m_conversationId;
    }

    inline qint64 createdTime() const {
        return m_createdTime;
    }

    inline qint64 senderId() const {
        return m_senderId;
    }

    inline qint64 receiverId() const {
        return m_receiverId;
    }
};

#endif // MESSAGEEVENT_H
